package com.cxx.home.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import com.cxx.common.dto.SessionDto;
import com.cxx.home.service.SessionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/session")
@Tag(name = "会话管理")
public class SessionController {
    @Resource
    private SessionService sessionService;

    @Operation(summary = "创建会话")
    @PostMapping("")
    @SaIgnore
    public SessionDto createSession(@RequestParam("name") String name,
                                    @RequestParam("password") String password) {
        return sessionService.create(name, password);
    }
}